import { httpGet, httpPost } from "../utils/http";

const apiUrl = "cwkb";

/**
 * 财务看板_资金预算_信息_年初
 * @param {*} param {year:'2023'}
 * @returns
 */
export function zjys_info(param) {
  return httpPost(`${apiUrl}/zjys_info_b`, param)
    .then((r) => r?.[0]?.data)
    .then((t) => t.records?.[0]);
}

/**
 * 财务看板_资金预算_信息_实时
 * @param {*} param 
 * @returns 
 */
export function zjys_info_now(param) {
  return httpPost(`${apiUrl}/zjys_info_now`, param)
    .then((r) => r?.[0]?.data)
    .then((t) => t.records?.[0]);
}


/**
 * 财务看板_现金流
 * @returns 
 */
export function xjl(param) {
  return httpPost(`${apiUrl}/xjl`, param)
    .then((r) => r?.[0]?.data)
    .then((t) => t.records);
}


/**
 * 财务看板_资金预算_完成情况_月_部门列表
 * @returns 
 */
export function zjys_finish_month_dp(){
  return httpPost(`${apiUrl}/zjys_finish_month_dp`,{}).then((r) => r?.[0]?.data)
  .then((t) => t.records);
}

/**
 * 财务看板_经营预算_收益负债
 * @param {*} param 
 * @returns 
 */
export function jyys_sf(param){
  return httpPost(`${apiUrl}/jyys_sf`,param).then((r) => r?.[0]?.data)
  .then((t) => t.records?.[0]);
}

/**
 * 财务看板_经营预算_达成率
 * @param {*} param 
 * @returns 
 */
export function jyys_dcl(param){
  return httpPost(`${apiUrl}/jyys_dcl`,param).then((r) => r?.[0]?.data)
  .then((t) => t.records?.[0]);
}

/**
 * 财务看板_经营预算_回款率
 * @param {*} param 
 * @returns 
 */
export function jyys_hkl(param){
  return httpPost(`${apiUrl}/jyys_hkl`,param).then((r) => r?.[0]?.data)
  .then((t) => t.records);
}

/**
 * 财务看板_资金预算_完成情况_月
 * @param {*} param 
 * @returns 
 */
export function zjys_finish_month(param){
  return httpPost(`${apiUrl}/zjys_finish_month`,param).then((r) => r?.[0]?.data)
  .then((t) => t.records);
}

/**
 * 财务看板_资金预算_完成情况_年_总数
 * @param {*} param 
 * @returns 
 */
export function zjys_finish_year(param){
  return httpPost(`${apiUrl}/zjys_finish_year`,param).then((r) => r?.[0]?.data)
  .then((t) => t.records?.[0]);
}

/**
 * 财务看板_资金预算_完成情况_年_各部门
 * @param {*} param 
 * @returns 
 */
export function zjys_finish_dep(param){
  return httpPost(`${apiUrl}/zjys_finish_dep`,param).then((r) => r?.[0]?.data)
  .then((t) => t.records);
}

/**
 * 财务看板_经营预算_月度_部门列表
 * @returns 
 */
export function jyys_month_dp(){
  return httpPost(`${apiUrl}/jyys_month_dp`,{}).then((r) => r?.[0]?.data)
  .then((t) => t.records);
}

/**
 * 财务看板_经营预算_月度
 * @returns 
 */
export function jyys_month(param){
  return httpPost(`${apiUrl}/jyys_month`,param).then((r) => r?.[0]?.data)
  .then((t) => t.records);
}

/**
 * 弹窗
 * @returns 
 */
export function zjys_finish_dep_detail(param){
  return httpPost(`${apiUrl}/zjys_finish_dep_detail`,param).then((r) => r?.[0]?.data)
  .then((t) => t.records);
}

